import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import fiximg from '@/directives/fiximg'
import Component from '@/components'
Vue.use(Component) // 注册自己的插件
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
import i18n from '@/i18n'
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

Vue.config.productionTip = false
Vue.directive('fiximg', fiximg)

// 过滤器
import * as myFilters from '@/filters'
for (const key in myFilters) {
  const value = myFilters[key]
  Vue.filter(key, value)
}

// 全局混入
import Mixin from './Mixin'
Vue.mixin(Mixin)
new Vue({
  el: '#app',
  router,
  i18n,
  store,
  render: (h) => h(App)
})
